<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=* , initial-scale=1.0">
    <title>Document</title>
    <style>
        #im{
            display: none;
        }
        #app{
            float: right;
        }
    </style>
    <script>
        function show(){
            document.getElementById("im").style.display="block";
        }
    </script>
</head>
<body>
    <button onclick="show()" type="button">切换显示</button>
    <div id="app">
        <button v-on:click="add()" type="button">增加年龄</button>
        <button v-on:click="rise()" type="button">减少年龄</button>
        <div v-if="people.age>18">
            <p>年龄满足18岁，可以入党。目前年龄：{{people.age}}</p>
            <img  id="pic" src="img/2.jpeg">
        </div>
        <div v-else>
            <p>年龄不满足18岁，不可以入党。目前年龄：{{people.age}}</p>
        </div>
    </div>
    <img  id="im" src="img/2.jpeg">
   

</body>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const Counter ={
        data(){
            return {
                people:{age:15}
            }
        },
        methods:{
            add:function(age){
                this.people.age++;
            },
            rise:function(age){
                if (this.people.age<=0){
                    alert("不能在减少了")
                    this.people.age=0;
                }else{
                    this.people.age-=1;
                }
            }
            },
            
        }  
    Vue.createApp(Counter).mount('#app')
</script>
</html>